<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">

  <title>struct</title>
  <link href="../cppreference.css" rel="stylesheet" type="text/css">
</head>

<body>
<table>
  <tr>
  <td>
  <div class="body-content">

  <div class="header-box">
    <a href="../index.html">cppreference.com</a> &gt; <a href=
    "index.html">C/C++ Keywords</a> &gt; <a href=
    "struct.html">struct</a>
  </div>

  <div class="name-format">
    struct
  </div>

  <div class="syntax-name-format">
    Syntax:
  </div>
  <pre class="syntax-box">
  struct struct-name : inheritance-list {
  public-members-list;    
  protected:
  protected-members-list;
  private:
  private-members-list;
  } object-list;
</pre>

  <p>Structs are like `classes`, except that by default members of a
  struct are <a href="public.html">public</a> rather than <a href=
  "private.html">private</a>. In C, structs can only contain data and
  are not permitted to have inheritance lists. For example:</p>
  <pre class="example-code">
   struct Date {
     int Day;
     int Month;
     int Year;
   };           
</pre>

  <div class="related-name-format">
    Related topics:
  </div>

  <div class="related-content">
    <a href="class.html">class</a><br>
    <a href="union.html">union</a>
  </div>
  </div>
  </td>
  


  </tr>
  </table>
</body></html>
